load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "export",
    srcs = [
        "block_allow_list.go",
        "config.go",
        "conn.go",
        "consistency.go",
        "dump.go",
        "http_handler.go",
        "ir.go",
        "ir_impl.go",
        "metadata.go",
        "metrics.go",
        "prepare.go",
        "retry.go",
        "sql.go",
        "sql_type.go",
        "status.go",
        "task.go",
        "util.go",
        "writer.go",
        "writer_util.go",
    ],
    importpath = "github.com/pingcap/tidb/dumpling/export",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/storage",
        "//br/pkg/summary",
        "//br/pkg/utils",
        "//br/pkg/version",
        "//config",
        "//dumpling/cli",
        "//dumpling/context",
        "//dumpling/log",
        "//errno",
        "//parser",
        "//parser/ast",
        "//parser/format",
        "//parser/model",
        "//store/helper",
        "//tablecodec",
        "//util",
        "//util/codec",
        "//util/dbutil",
        "//util/promutil",
        "//util/table-filter",
        "@com_github_coreos_go_semver//semver",
        "@com_github_docker_go_units//:go-units",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_google_uuid//:uuid",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_log//:log",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_client_golang//prometheus/promhttp",
        "@com_github_prometheus_client_model//go",
        "@com_github_soheilhy_cmux//:cmux",
        "@com_github_spf13_pflag//:pflag",
        "@com_github_tikv_pd_client//:client",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_x_exp//slices",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_multierr//:multierr",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "export_test",
    timeout = "short",
    srcs = [
        "block_allow_list_test.go",
        "config_test.go",
        "consistency_test.go",
        "dump_test.go",
        "ir_impl_test.go",
        "main_test.go",
        "metadata_test.go",
        "metrics_test.go",
        "prepare_test.go",
        "sql_test.go",
        "sql_type_test.go",
        "status_test.go",
        "util_for_test.go",
        "util_test.go",
        "writer_serial_test.go",
        "writer_test.go",
    ],
    data = glob(["**"]),
    embed = [":export"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//br/pkg/storage",
        "//br/pkg/version",
        "//config",
        "//dumpling/context",
        "//dumpling/log",
        "//errno",
        "//parser",
        "//util/filter",
        "//util/promutil",
        "//util/table-filter",
        "@com_github_coreos_go_semver//semver",
        "@com_github_data_dog_go_sqlmock//:go-sqlmock",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_prometheus_client_golang//prometheus/collectors",
        "@com_github_stretchr_testify//require",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_goleak//:goleak",
    ],
)
